//
//  PPAlbumContentTableViewTagCell.m
//  pickpic
//
//  Created by Jinxiao on 9/11/16.
//  Copyright © 2016 MicroDream. All rights reserved.
//

#import "PPAlbumContentTableViewTagCell.h"

#import "PPAlbumContentViewDataSource.h"

@implementation PPAlbumContentTableViewTagCell

- (void)setDataSource:(PPAlbumContentViewDataSource *)dataSource {
    _dataSource = dataSource;

    if(dataSource.tags.count == 0) {
        _tagLabel.text = @"添加标签";
    } else {
        NSMutableArray *names = [NSMutableArray array];
        [dataSource.tags enumerateObjectsUsingBlock:^(PPAlbumTagElement *_Nonnull obj, NSUInteger idx, BOOL *_Nonnull stop) {
            [names addObject:obj.name];

            if(idx == 2) {
                *stop = YES;
            }
        }];
        _tagLabel.text = [names componentsJoinedByString:@"、"];
    }
}

@end
